#pragma once
#include <stdlib.h>
#include <sys/epoll.h>

class Epoll
{
private:
    static const int gsize = 256;

public:
    static int CreateEpoll()
    {
        int epfd = epoll_create(gsize);
        if (epfd != -1)
        {
            return epfd;
        }
        exit(-1);
    }
    static bool CtlEpoll(int epfd, int op, int sock, uint32_t evens)
    {
        epoll_event event;
        event.data.fd = sock;
        event.events = evens;
        return (epoll_ctl(epfd, op, sock, &event) == 0);
    }
    static int WaitEpoll(int epfd, epoll_event *events, int num, int timeout)
    {
        return epoll_wait(epfd, events, num, timeout);
    }
};